/**
 * Devil demo
 * @author hoang.pt
 * @version $Id: DevilTest.java 99 2010-08-28 15:47:12Z phantichhoang $
 */

package snippet.lab1;

/**
 * Devil main
 * @author hoang.pt
 */
public class DevilTest {

	/**
	 * constructor
	 */
	public DevilTest() {

	}

	/**
	 * Main app
	 * @param String a
	 */
	public static void main(String[] args) {
		//init daemon thread
		Devil d = new Devil("My Devil", true);
		System.out.println(d.isDaemon());
		
        //init daemon
		Angel a = new Angel("My Angel Girl", false);
        a.setDaemon(d.state);
        a.start();
        System.out.println("Daemon is: " +a.isDaemon());

        //test API isAlive and isDaemon
        Devil d2 = new Devil("not daemon", false);
        System.out.println(d2.isDaemon());
        System.out.println(d2.isAlive());

        d2.interrupt();
        System.out.println(d2.isAlive());
        System.out.println(d2.isInterrupted());		
		
	}
	
}
